<?php
namespace frontend\controllers;

use Yii;
use yii\web\Controller;
use common\models\YmhSeo;
use common\models\VideoPic;
use common\models\Product;
use common\models\Videos;

class ProjectsController extends Controller {

    public function actionProjects() {
        $seo=YmhSeo::findOne(2);
        $view = Yii::$app->view;
        $view->params['layout_data']['menu'] = 'projects';
        $view->params['layout_data']['seo'] = $seo;
        $pro_list = Product::getProCat();
        $view->params['layout_data']['pro_list'] = $pro_list;
        $model_Pic = VideoPic::getPicList();
        $c_video = Videos::getVideoJx();
        $page = ceil(count($c_video)/3);
        foreach ($model_Pic as $key=>$value) {
            $pages[$key] =  $value['page'];
        }
        $pages = array_unique($pages);
        sort($pages);
//        var_dump($page);die();
        return $this->render("projects",['model_Pic'=>$model_Pic,'page'=>$page,'pages'=>$pages]);
    } 
    
    
    public function actionMProjects() {
        $this->layout = 'main_local';
        $seo=YmhSeo::findOne(2);
        $view = Yii::$app->view;
        $view->params['layout_data']['menu'] = 'projects';
        $view->params['layout_data']['seo'] = $seo;
        $pro_list = Product::getProCat();
        $view->params['layout_data']['pro_list'] = $pro_list;
        $model_Pic = VideoPic::getPicList();
        $c_video = Videos::getVideoJx();
        $page = ceil(count($c_video)/3);
        foreach ($model_Pic as $key=>$value) {
            $pages[$key] =  $value['page'];
        }
        $pages = array_unique($pages);
        sort($pages);
//        var_dump($page);die();
        return $this->render("m-projects",['model_Pic'=>$model_Pic,'page'=>$page,'pages'=>$pages]);
    } 

}

?>